#include <SGE.h>

using namespace SGE;

SGE_Sprite sprite;
SVector2 position;
bool quit = false;

void SGE_Initialize()
{
	sprite.Load("megaman.png");
}

void SGE_Terminate()
{
	sprite.Unload();
}

bool SGE_Update(float deltaTime) // bool says when to quit, 
{
	const float kSPEED = 100.0f;

	if (Input_IsKeyDown(Keys::RIGHT))
	{
		//position.x += 1.0f; // Dont want frame dependancy movement
		position.x += kSPEED * deltaTime;
	}
	else if (Input_IsKeyDown(Keys::LEFT))
	{
		position.x -= kSPEED * deltaTime;
	}

	if (Input_IsKeyDown(Keys::UP)) // Can do either up or down while moving left or right
	{
		position.y -= kSPEED * deltaTime;
	}
	else if (Input_IsKeyDown(Keys::DOWN))
	{
		position.y += kSPEED * deltaTime;
	}

	if (Input_IsKeyPressed(Keys::ESCAPE))
	{
		quit = true; // To exit
	}

	return quit;
}

void SGE_Render()
{
	sprite.SetPosition(position);
	sprite.Render();
}